import { createStore } from "vuex";
import router, { resetRouter } from "@/router";

export default createStore({
  state: {
    currentPathName: "",
    base_url: "http://47.92.157.229:8888/",
  },
  getters: {},
  mutations: {
    setPath(state) {
      this.state.currentPathName = localStorage.getItem("currentPathName");
    },
    logout() {
      //清空缓存
      localStorage.removeItem("employee");
      localStorage.removeItem("menus");
      localStorage.removeItem("token");
      localStorage.removeItem("location");
      router.push("/login");
      //重置路由
      // resetRouter();
    },
  },
  actions: {},
  modules: {},
});
